const { AsyncSeriesHook } = require('tapable')

let hook = new AsyncSeriesHook(['name']);

console.time('time2')
hook.tapPromise('tapPromise1', function (name) {
  return new Promise(function (resolve, reject) {
    setTimeout(() => {
      console.log(`tapPromise1:`, name)
      resolve()
    }, 1000)
  })
})
hook.tapPromise('tapPromise2', function (name) {
  return new Promise(function (resolve, reject) {
    setTimeout(() => {
      console.log(`tapPromise2:`, name)
      resolve()
    }, 2000)
  })
})

hook.promise('promise').then(function () {
  console.timeEnd('time2')
})